#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

class Solution{
    public:
    int ans1(vector<int>& nums, int target){
        int len = nums.size();
        int left = 0, right = len - 1;
        int ret = len;
        while(left <= right){
            int mid = left + (right - left) / 2;
            if(target <= nums[mid]){
                ret = mid;
                right = mid-1;
            }else{
                left = mid+1;
            }
        }
        
        return ret;
    }
};

void test1(){
    Solution s;
    vector<int> nums = {1,3,5,6};
    int target = 5;

    int ret = s.ans1(nums, target);
    cout << ret << endl;

}

void test2(){
    Solution s;
    vector<int> nums = {1,3,5,6};
    int target = 2;

    int ret = s.ans1(nums, target);
    cout << ret << endl;

}

void test3(){
    Solution s;
    vector<int> nums = {1,3,5,6};
    int target = 7;

    int ret = s.ans1(nums, target);
    cout << ret << endl;

}

int main(void){
    test1();
    test2();
    test3();

    return 0;
}